<template>
  <div>
    <slot name="insertFooter"></slot>
    <a-button
      :type="continueType"
      @click="handleContinue"
      :loading="continueLoading"
      :disabled="confirmLoading"
      v-bind="continueButtonProps"
      v-if="showContinueBtn">
      {{ continueText }}
    </a-button>
    <a-button v-bind="cancelButtonProps" @click="handleCancel" v-if="showCancelBtn">
      {{ cancelText }}
    </a-button>
    <slot name="centerFooter"></slot>
    <a-button
      :type="okType"
      @click="handleOk"
      :loading="confirmLoading"
      v-bind="okButtonProps"
      :disabled="okButtonProps?.disabled || continueLoading"
      v-if="showOkBtn">
      {{msg=='true'?'提交审核': okText }}
    </a-button>
    <slot name="appendFooter"></slot>
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';

  import { basicProps } from '../props';
  // 引入路由
  import { useRoute } from 'vue-router';
  export default defineComponent({
    name: 'BasicModalFooter',
    props: basicProps,
    emits: ['ok', 'continue', 'cancel'],
    setup(_, { emit }) {
      const route = useRoute();
      let  msg = localStorage.getItem('msg')
      if (msg=='true') {
        switch (route.path) {
             case '/permission/position':
              // 岗位管理的逻辑
              break;
             case '/permission/user':
             // 用户管理的逻辑
              break;
             case '/permission/role':
            // 角色管理的逻辑
             break;
             case '/permission/gradeManage':
             // 分级管理的逻辑
             break;
             case '/permission/group':
             // 分组管理的逻辑
             break;
             case '/permission/authorize':
            // 权限管理的逻辑
            break;
            default:
             msg='false'
             }
      }
      
      function handleOk(e: Event) {
        emit('ok', e);
      }
      function handleContinue(e: Event) {
        emit('continue', e);
      }
      function handleCancel(e: Event) {
        emit('cancel', e);
      }

      return { handleOk, handleContinue, handleCancel,msg };
    },
  });
</script>
